using System;
using System.Collections.Generic;
using System.Text;

namespace Colman.Rpg
{
    /// <summary>
    /// Represents the base class for any item in the game: weapon, armor, magic items, etc.
    /// </summary>
    [Serializable]
    public abstract class Item
    {
        /// <summary>
        /// Creates a new instance of <see cref="Item" />.
        /// </summary>
        /// <param name="dp">The defense points gained by using the item.</param>
        /// <param name="ap">The attack points gained by using the item.</param>
        /// <param name="name">The name of the item.</param>
        /// <param name="amount">The amount of the same item.</param>
        /// <param name="cost">The cost of the item, per unit.</param>
        protected Item(int dp, int ap, string name, int amount, int cost)
        {
            this.defensePoints = dp;
            this.attackPoints = ap;
            this.name = name;
            this.amount = amount;
            this.cost = cost;
        }

        #region int DefensePoints { get; } (defensePoints)
        private int defensePoints;

        /// <summary>
        /// Gets the defense points the armor has.
        /// </summary>
        public int DefensePoints
        {
            [System.Diagnostics.DebuggerStepThrough]
            get
            {
                return this.defensePoints;
            }
        }
        #endregion

        #region int AttackPoints { get; } (attackPoints)
        private int attackPoints;

        /// <summary>
        /// Gets the attack points the weapon has.
        /// </summary>
        public int AttackPoints
        {
            [System.Diagnostics.DebuggerStepThrough]
            get
            {
                return this.attackPoints;
            }
        }
        #endregion

        #region string Name { get; } (name)
        private string name;

        /// <summary>
        /// Gets the item's name or type.
        /// </summary>
        public string Name
        {
            [System.Diagnostics.DebuggerStepThrough]
            get
            {
                return this.name;
            }
            protected set
            {
                this.name = value;
            }
        }
        #endregion

        #region int Amount { get; } (amount)
        private int amount;

        /// <summary>
        /// Gets the amount of the item in this instance.
        /// </summary>
        [System.ComponentModel.Description("Indicates the amount of the item in this instance.")]
        public int Amount
        {
            [System.Diagnostics.DebuggerStepThrough]
            get
            {
                return this.amount;
            }
        }
        #endregion

        #region int Cost { get; } (cost)
        private int cost;

        /// <summary>
        /// Gets the cost of the item per unit.
        /// </summary>
        [System.ComponentModel.Description("Indicates the cost of the item per unit.")]
        public int Cost
        {
            [System.Diagnostics.DebuggerStepThrough]
            get
            {
                return this.cost;
            }
        }
        #endregion

        /// <summary>
        /// When implemented in a base class, gets the same item as the current object is, only with the <see cref="Item.Amount"/> property set to 1.
        /// </summary>
        /// <returns>The same item as the current object is, only with the <see cref="Item.Amount"/> property set to 1.</returns>
        public abstract Item GetOne();
    }
}
